<?php
$mes = file_get_contents('url.txt');
$config =$mes = explode("\r\n",$mes);
$conf = require 'conf.php';
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="renderer" content="webkit">
    <title><?=$conf['title']?></title>
    <link rel="icon" href="img/bgIcon.jpg" type="image/x-icon"/>
    <meta name="msapplication-TileColor" content="#da532c">
    <meta name="msapplication-TileImage" content="/img/mstile-144x144.png">
    <script type="text/javascript">

        (function(){
            //判断是否来自PC，是否调用箭头滑动的方法。
            var _isMobileBrowser = /Android|webOS|iPhone|iPad|iPod|BlackBerry|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(							  navigator.userAgent) ?  true : false;
        })();
    </script>
    <link href="css/flyerPreview.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="preContainer">
    <div class="preContent">
        <div class="preLink" style="">

            <div class="preQRCode">
                <div class="qrCode">
                    <img src="/getqrcode.php?code=<?=$config[1]?>"/ >
                </div>
                <div class="preSweep">
                    手机扫一扫更精彩
                </div>
            </div>

            <!-- <div class="noCopy">用户作品（不可复制）</div> -->

        </div>
        <div class="flyerSimulator">
            <div class="preScreen">
                <div class="pageMobi">
                    <iframe class="preIframe" width="750px" height="1206px" src ="mobiles.php" >
                        <p>您的浏览器不支持iframe标签</p>
                    </iframe>
                </div>
            </div>
            <div class="simulatorMouse">
                <div id="mouseUp" class="mouseUp upDownBtn disabled"></div>
                <div id="preCurrentPage" class="preCurrentPage">1</div>
                <div id="mouseDown" class="mouseDown upDownBtn disabled"></div>
            </div>
        </div>
    </div>
</div>
<script type='text/javascript' src="/js/jquery-core.min.js?v=201706261814"></script>
<script>
    var userAgent = navigator.userAgent.toLowerCase();
    var isIE = userAgent.indexOf("msie"),
        isIE11 = userAgent.indexOf(".net"),
        rchrome = /chrome\/\d+/,
        isFireFox = userAgent.indexOf("firefox");
    //webkit内核太低不给玩
    var lowWebKit = false;
    var webKitVersion = userAgent.match(/webkit\/\d{3}.\d+/gi);
    if( webKitVersion ){
        webKitVersion = webKitVersion[0].split('/');
        if(webKitVersion.length > 1){
            webKitVersion = parseFloat(webKitVersion[1]);
            lowWebKit = webKitVersion >= 537.36 ? false : true;
        }
    }
    var chromeVer = userAgent.match(rchrome);
    if(chromeVer){
        chromeVer = chromeVer[0].split('/');
        if(chromeVer.length > 1){
            chromeVer = parseFloat(chromeVer[1]);
            lowWebKit = chromeVer >= 38 ? false : true;
        }
    }
    var isUIManage = false;
    var isOperateManage = false;
    var faiscoaid = 12259034;
    var flyerId = 107;
    //统计
    function logDog(dogId, dogSrc){
        if(isUIManage && !isOperateManage){
            return;
        }
        if(isOperateManage){
            if(dogId == 2000022 || dogId == 2000023 || dogId == 2000024 || dogId == 2000025 ){
                dogId += 10;
            }
            dogSrc = flyerId*100+dogSrc;
        }
    }
    $(function(){
        var innerHeight = $(window).innerHeight();
        var screenH = 684;
        var screenW = 424;
        var contentW = 904;
        var simulatorW = 533;
        var border = 8*2;
        //480是字体不变形的最小高度。
        var minHeight = 480;
        var count = function(){
            //以谷歌浏览器在1920*1080屏幕下的数值为参照计算其他窗口或者浏览器的iframe尺寸，此时谷歌innerHeight为979
            innerHeight = $(window).innerHeight();
            var height = Number((screenH/ 979 * innerHeight).toFixed(2));
            height = height > minHeight ? height : minHeight;
            var width = height * 0.6219;

            var scale = Number(( (width) / 750 ).toFixed(6));
            var translate = Number(((1-scale) / (scale * 2) * 100).toFixed(4));
            var transform = 'scale('+scale+') translate3d(-'+translate+'%,-'+translate+'%,0)';

            $(".preScreen").css({
                "width": Math.floor(width) ,
                "height": Math.floor(height)
            });
            $('.preScreen .pageMobi').css({
                '-webkit-transform':transform,
                '-moz-transform':transform,
                '-o-transform':transform,
                'transform':transform
            });
            $(".preContent").css({
                "width" : contentW - (screenW - width) ,
                "height" : height + border ,
                "margin-top" : -(height + border)/2
            });
            $(".flyerSimulator").css({
                "width": simulatorW - (screenW - width) ,
                "height": height + border
            });
        };
        count();
        $(window).off("resize").on("resize",function(){
            //计算当前窗口iframe的高度是否小于最小高度且iframe的高度已等于最小高度，如果是，则让高度相等，不再计算，如果不是则重新计算iframe高度。
            var nHeight = ((screenH / 979 * $(window).innerHeight() < 480) && ($(".preScreen").height() == 480))?
                innerHeight : $(window).innerHeight();
            if(innerHeight != nHeight){
                count();
                $(".preCurrentPage").text("1");
                $("iframe").get(0).contentWindow.location.reload(true);
            };
        });
        logDog(2000042,0);
        $(".preHome").on("click",function(){
            logDog(2000043,0);
        });
    });
</script>
</body>
</html>